package xupt.se.ttms.service;

import java.sql.ResultSet;
import java.util.List;

import xupt.se.ttms.idao.DAOFactory;
import xupt.se.ttms.idao.iEmployeeDAO;
import xupt.se.ttms.model.Employee;

public class EmployeeSrv {
	private iEmployeeDAO employeeDAO=DAOFactory.creatEmployeeDAO();
	public boolean add(Employee employee) throws Exception{
		
		return employeeDAO.execInsert(employee);
	}
	
	public boolean modify(Employee employee) throws Exception{
		return employeeDAO.execUpdate(employee); 		
	}
	
	public boolean delete(int ID) throws Exception{
		return employeeDAO.execDelete(ID);		
	}
	
	public List<Employee> Fetch(String condt) throws Exception{
		ResultSet resultSet=employeeDAO.execQuery(condt);	
		return employeeDAO.HandleEmployeeResultSet(resultSet);	
	}
	
	public List<Employee> FetchAll() throws Exception{
		ResultSet resultSet=employeeDAO.exexQueryAll();
		return employeeDAO.HandleEmployeeResultSet(resultSet);		
	}
}	
